/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model.ReportTypes;

import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import stuff.FDate;

/**
 *
 * @author JArik
 */
public class ProfitReport {
    private FDate date;
    private int visitId;
    private double drugsPrice,
                   drugsBuyPrice,
                   operPrice,
                   otherPrice,
                   visitPrice,
                   overall;

    public double getDrugsBuyPrice() {
        return drugsBuyPrice;
    }

    public void setDrugsBuyPrice(double drugsBuyPrice) {
        this.drugsBuyPrice = drugsBuyPrice;
    }

    public String getDay()
    {
        SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
        Calendar cal = Calendar.getInstance();
        try {
            cal.setTimeInMillis(sdf.parse(date.toString()).getTime());
        } catch (ParseException ex) {
            return "Неправельная дата.";
        }
        int dow = cal.get(Calendar.DAY_OF_WEEK);
        switch(dow)
        {
            case Calendar.MONDAY: return "Понедельник";
            case Calendar.TUESDAY: return "Вторник";
            case Calendar.WEDNESDAY: return "Среда";
            case Calendar.THURSDAY: return "Четверг";
            case Calendar.FRIDAY: return "Пятница";
            case Calendar.SATURDAY: return "Суббота";
            case Calendar.SUNDAY: return "Воскресенье";
        }
        return "Неправельная дата.";
    }
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {

        if(date != null)
        this.date = new FDate(date.getTime());
    }

    public double getDrugsPrice() {
        return drugsPrice;
    }

    public double getDrugsProfit()
    {
       return drugsPrice - drugsBuyPrice;
    }
    public void setDrugsPrice(double drugsPrice) {
        this.drugsPrice = drugsPrice;
    }

    public double getOperPrice() {
        return operPrice;
    }

    public void setOperPrice(double operPrice) {
        this.operPrice = operPrice;
    }

    public double getOtherPrice() {
        return otherPrice;
    }

    public void setOtherPrice(double otherPrice) {
        this.otherPrice = otherPrice;
    }

    public double getOverall() {
        return getDrugsProfit() + operPrice + visitPrice + otherPrice;
    }

    public void setOverall(double overall) {
        this.overall = overall;
    }
    public int getVisitId() {
        return visitId;
    }

    public void setVisitId(int visitId) {
        this.visitId = visitId;
    }
    

    public double getVisitPrice() {
        return visitPrice;
    }

    public void setVisitPrice(double visitPrice) {
        this.visitPrice = visitPrice;
    }
    

}
